package com.santu.edu.supporter.biz.order.wm.pojo.enums;

import com.santu.edu.supporter.exception.BizException;
import com.santu.edu.supporter.exception.CustomError;

/**
 * @author luoyaoqi
 * @createTime 2024/2/22
 * @description
 */
public enum WmTypeEnum {

    /**
     *
     */
    DELIVERY_NOT_DELIVERED(0, "外卖未送到"),
    DELIVERY_DELIVERED(1, "外卖已送到"),
    DELIVERY_PICKED(2, "已取货");


    private Integer code;

    private String desc;

    WmTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static WmTypeEnum convert(Integer code) {
        for (WmTypeEnum wmType : WmTypeEnum.values()) {
            if (wmType.getCode().equals(code)) {
                return wmType;
            }
        }
        throw BizException.causeBy(CustomError.ENUM_CONVERT_ERROR,"TimeSectionType转换异常");
    }
}
